package com.mit.web.business.proxy
{
	import com.mit.web.business.remote.BaseService;
	import com.mit.web.business.remote.IInvokeResponder;
	import com.mit.web.config.Constants;
	import com.mit.web.config.DisplayConfiguration;
	import com.mit.web.vo.maintenance.EmployeeVO;
	import com.mit.web.vo.maintenance.OrganizationVO;
	
	import mx.collections.ArrayCollection;

	public class MaintenanceProxy extends BaseService
	{
		private static var me:MaintenanceProxy;
		public function MaintenanceProxy()
		{
			super(Constants.REMOTE_OBJECT_MAINTENANCE);
			if(me != null)
				throw new Error("Only one instance of this class is allowed, use getInstance() insteadof the constructor.");
		}
		
		public static function getInstance():MaintenanceProxy{
			if(me == null)
				me = new MaintenanceProxy();
			return me;
		} 
		
		public function getProductTypes():IInvokeResponder{
			return invoke("retrieveProductTypes");
		}
		
		public function updateProductTypes(updateList:ArrayCollection):IInvokeResponder{
			return invoke("updateProductTypes", updateList);
		}
		
		public function getEmployees():IInvokeResponder{
			return invoke("retrieveEmployees");
		}
		
		public function getActiveEmployees():IInvokeResponder{
			return invoke("retrieveActiveEmployees");
		}
		
		public function getActiveDepartments():IInvokeResponder{
			return invoke("retrieveActiveDepartments");
		}
		
		public function getPagedEmployees(empCode:String, depId:int, pageNo:int):IInvokeResponder{
			return invoke("retrievePagedEmployees", empCode, depId, pageNo, DisplayConfiguration.getInstance().PAGE_SIZE);
		}
		
		public function getEmployeesCount(empCode:String, depId:int):IInvokeResponder{
			return invoke("retrieveEmployeesCount");
		}
		
		public function retrieveEmployeeById(empId:int):IInvokeResponder{
			return invoke("retrieveEmployeeById", empId);
		}
		
		public function deleteEmployee(employee:EmployeeVO):IInvokeResponder{
			return invoke("deleteEmployee", employee);
		}
		
		public function createEmployee(employee:EmployeeVO):IInvokeResponder{
			return invoke("createEmployee", employee);
		}

		public function updateEmployee(employee:EmployeeVO):IInvokeResponder{
			return invoke("updateEmployee", employee);
		}
		
		public function getDepPieItems():IInvokeResponder{
			return invoke("retrieveDepartmentStatItem");
		}
		
		/**** Product Color Maintenance ***/
		public function getProductColors():IInvokeResponder{
			return invoke("retrieveProductColors");
		}
		
		public function updateProductColors(updateList:ArrayCollection):IInvokeResponder{
			return invoke("updateProductColors", updateList);
		}
		
		/**** Unit Maintenance ***/
		public function getUnits():IInvokeResponder{
			return invoke("retrieveUnits");
		}
		
		public function updateUnits(updateList:ArrayCollection):IInvokeResponder{
			return invoke("updateUnits", updateList);
		}
		
		/**** Payment Maintenance ***/
		public function getPayments():IInvokeResponder{
			return invoke("retrievePayments");
		}
		
		public function updatePayments(updateList:ArrayCollection):IInvokeResponder{
			return invoke("updatePayments", updateList);
		}
		
		/**** Fabric Category Maintenance ***/
		public function getFabricCats():IInvokeResponder{
			return invoke("retrieveFabricCats");
		}
		
		public function updateFabricCats(updateList:ArrayCollection):IInvokeResponder{
			return invoke("updateFabricCats", updateList);
		}
		
		public function getSeasons():IInvokeResponder{
			return invoke("retrieveSeasons");
		}
		
		public function updateOrganization(organization:OrganizationVO):IInvokeResponder{
			return invoke("updateOrganization", organization);
		}
		
		public function retrieveOrganization(orgId:int):IInvokeResponder{
			return invoke("retrieveOrganization", orgId);
		}
	}
}